Skip to content

wcurl: prevent silent overwrite with --output on older curl#99

Merged
sergiodj merged 3 commits into
curl:mainfrom
arpitguptagithub:fix-multiple-urls-old-curl
May 1, 2026
Merged

wcurl: prevent silent overwrite with --output on older curl#99
sergiodj merged 3 commits into
curl:mainfrom
arpitguptagithub:fix-multiple-urls-old-curl

Conversation

@arpitguptagithub

Copy link
Copy Markdown
Contributor

Well this PR is a small one and just adds a defensive check to exec_curl() to return an error when the user explicitly passes --output alongside multiple URLs, but has a curl version older than 7.83.0, but this is something that caused me too much frustration.

In current scenatio what happens is when --output is explicitly provided, wcurl uses the identical OUTPUT_PATH for every single URL in the loop.

On modern curl versions, --no-clobber correctly prevents overwrites by appending numeric suffixes (.1, .2, etc.).

However, wcurl project supports curl 7.46.0 and higher.

On versions prior to7.83.0 ( based on change logs) , the --no-clobber flag is missing, causing multiple file downloads to silently overwrite the same local file sequentially.

This throws a user-facing error to prevent silent data loss, and not leave them clueless

@sergiodj sergiodj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Minor nit regarding quotes in the error message, but otherwise this LGTM.

Comment thread wcurl Outdated
arpitguptagithub and others added 2 commits May 2, 2026 05:05
Updating error format based on suggestion

Co-authored-by: Sergio Durigan Junior <github@sergiodj.net>
@arpitguptagithub arpitguptagithub requested a review from sergiodj May 1, 2026 23:35

@sergiodj sergiodj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sergiodj sergiodj merged commit 42260c2 into curl:main May 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants